//
//  centerButtonView.m
//
//
//  Created by gynjobs on 2017/8/11.
//  Copyright © 2017年 gynjobs. All rights reserved.
//

#import "centerButtonView.h"

@interface centerButtonView()
@property(strong,nonatomic)UIButton *centerButton;
@end

@implementation centerButtonView
-(instancetype)init{
    self = [super init];
    if (self) {
        [self addSubWidghButton];
    }
    return self;
}
-(void)addSubWidghButton{
    UIButton *centerButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [centerButton setBackgroundColor:[UIColor clearColor]];
    [centerButton setTitle:self.buttonString forState:UIControlStateNormal];
    [centerButton setTitleColor:[UIColor colorWithString:self.buttonTitleColor] forState:UIControlStateNormal];
    [centerButton setTitleColor:[UIColor colorWithString:self.buttonTitleSeleColor] forState:UIControlStateSelected];
    self.centerButton = centerButton;
    [self addSubview:centerButton];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [self.centerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
        make.left.equalTo(self.mas_left).offset(13);
        make.right.equalTo(self.mas_right).offset(-13.0);
        make.height.mas_equalTo(R_Y_H(75.0));
    }];
//    [self mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.centerButton.mas_top).offset(-R_Y_H(35.0));
//        make.bottom.equalTo(self.centerButton.mas_bottom).offset(R_Y_H(55.0));
//    }];
    [self.centerButton layoutIfNeeded];
    [self.centerButton setBackgroundImage:[UIImage imageWithColor:[UIColor blueColor] size:self.centerButton.frame.size] forState:UIControlStateNormal];
    [self.centerButton setBackgroundImage:[UIImage imageWithColor:[UIColor grayColor] size:self.centerButton.frame.size] forState:UIControlStateSelected];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
